package com.example.h1nson.photoshare;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.TabHost;


public class MainActivity extends TabActivity
{

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.activity_main);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
                R.layout.titlebar);
        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;
        Intent intent;  // Reusable Intent for each tab

        //��һ��Tab
        intent = new Intent(this,FirstActivity.class);//�½�һ��Intent����Tab1��ʾ������
        spec = tabHost.newTabSpec("tab1")//�½�һ�� Tab
                .setIndicator("推送", res.getDrawable(android.R.drawable.ic_media_play))//���������Լ�ͼ��
                .setContent(intent);//������ʾ��intent������Ĳ���Ҳ������R.id.xxx
        tabHost.addTab(spec);//��ӽ�tabHost

        //�ڶ���Tab
        intent = new Intent(this,SecondActivity.class);//�ڶ���Intent����Tab1��ʾ������
        spec = tabHost.newTabSpec("tab2")//�½�һ�� Tab
                .setIndicator("发现", res.getDrawable(android.R.drawable.ic_menu_edit))//���������Լ�ͼ��
                .setContent(intent);//������ʾ��intent������Ĳ���Ҳ������R.id.xxx
        tabHost.addTab(spec);//��ӽ�tabHost

        //������Tab
        intent = new Intent(this,ThirdActivity.class);//�ڶ���Intent����Tab1��ʾ������
        spec = tabHost.newTabSpec("tab3")//�½�һ�� Tab
                .setIndicator("动态̬", res.getDrawable(android.R.drawable.ic_menu_help))//���������Լ�ͼ��
                .setContent(intent);//������ʾ��intent������Ĳ���Ҳ������R.id.xxx
        tabHost.addTab(spec);//��ӽ�tabHost

        //������Tab
        intent = new Intent(this,FourthActivity.class);//�ڶ���Intent����Tab1��ʾ������
        spec = tabHost.newTabSpec("tab4")//�½�һ�� Tab
                .setIndicator("我", res.getDrawable(android.R.drawable.ic_menu_myplaces))//���������Լ�ͼ��
                .setContent(intent);//������ʾ��intent������Ĳ���Ҳ������R.id.xxx
        tabHost.addTab(spec);//��ӽ�tabHost

        tabHost.setCurrentTab(4);//���õ�ǰ��ѡ�,����ΪTab1
    }

}